<?php

namespace App\Http\Controllers\Platform\Doc;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\Common\TreeResource;
use App\Http\Resources\Common\DataResource;
use App\Models\Game\Platform\Doc\Tree;

class TreeController extends Controller
{

    /**
     * 获取数据列表
     */
    public function getList(Request $request)
    {
        $trees = Tree::selectAll();

        return new DataResource([
            'dataList' => $trees->keyBy('id')->toArray(),
            'treeList' => TreeResource::make($trees)->toTree($request),
        ]);
    }
}
